<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 编写一个函数求一个数字是否是质数 -->
    <script>
      function fn(num) {
        var con = 0;
        for (var i = 1; i <= num; i++) {
          if (num % i == 0) {
            con++;
          }
        }
        if (con == 2) {
          document.write(num + "是质数");
        } else {
        }
      }
      fn(11);
    </script>
  </body>
</html>
